package day0728API.time;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Test2 {
    public static void main(String[] args) {
        LocalDateTime time=LocalDateTime.now();//now():   new LocalDateTime(date年月日, time时分秒)
        System.out.println(time);

        System.out.println(time.getMonth());
        System.out.println(time.getYear());
        System.out.println(time.getDayOfYear());
        System.out.println(time.getDayOfWeek());
        System.out.println(time.getHour());


        //修改LocalDateTime对象的时间格式：
        DateTimeFormatter  formatter=DateTimeFormatter.ofPattern("dd/MM$yyyy  hh:mm:ss");
        String rs=time.format(formatter);
        System.out.println(rs);

    }
}
